-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
testers.hasPkgConfigModules: fix bug in versionCheck
handling
#311069
Conversation
Shell script is currently buggy and effectively ignores the value, always enforcing version match: NixOS#307770 (comment)
Broke tests, as the version check was effectively always enabled: NixOS#307770 (comment)
@roberth Sorry, it was easier to put together an alternative PR, than figure out how to make it through Github's “suggestions” features. In short, the bug was entirely caused by the broken conditional @OPNA2608 pointed out, and I don't think we need to do anything more complicated around it. Apologies for the breakage, I forgot to include in the o.g. PR a test for the case where |
Result of |
I manually checked that
Ideally we'd replace the ❌ with something like ⚠ when |
Good idea to just open a PR. I like your idea, but it needs a bit of work. I didn't bother with a warning, but if we're going to warn, we should be careful not to cause warning fatigue.
What do you think? |
Not sure what you mean, I fixed the extent conditional but didn't add a new warning? Right now, callers won't normally see the version-mismatch messages because they are only part of the tester's build log, and not displayed unless the test fails. I added 43efaaa to make it clear that those version mismatches are not test failures (unless I had some thoughs how to gently push callers towards using |
That's what I meant, yeah.
Users of the package won't, but maintainers and contributors to the package will, and they won't easily understand what's going on.
Interesting. I agree that we should first fix the error behavior, but I don't think we should trade it for a release that causes warning fatigue. Maybe remove the message altogether when the version check is disabled? Then we can merge that and add a helpful message without hurry. |
echo "${if versionCheck then "❌" else "⚠"} pkg-config module $moduleName exists and has version $moduleVersion when $version was expected" | ||
((versionMismatch+=1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To make my suggestion more concrete, from #311069 (comment)
This is a little silly and untested, but I guess it gets the intended behavior across, fwiw.
echo "${if versionCheck then "❌" else "⚠"} pkg-config module $moduleName exists and has version $moduleVersion when $version was expected" | |
((versionMismatch+=1)) | |
${if versionCheck | |
then '' | |
echo "❌ pkg-config module $moduleName exists and has version $moduleVersion when $version was expected" | |
((versionMismatch+=1)) | |
'' | |
# TODO: figure out the UX for enabling the version check; see https://github.com/NixOS/nixpkgs/pull/311069 | |
else '' | |
echo "✅ pkg-config module $moduleName exists and has version $moduleVersion" | |
''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's tempting to add more info to the message, but that will just serve to distract whoever reads it, if we don't explain it, which is out of scope for this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer more-uniform code, rather than more Bash codegen through text templating; would something like this be fine with you?
echo "${if versionCheck then "❌" else "⚠"} pkg-config module $moduleName exists and has version $moduleVersion when $version was expected" | |
((versionMismatch+=1)) | |
echo "${if versionCheck then "❌" else "ℹ️"} pkg-config module $moduleName exists at version $moduleVersion != $version (drv version)" | |
((versionMismatch+=1)) |
The wording is more neutral, so it seems like a normal info message unless versionCheck
(the versionMismatch
counter is unused unless versionCheck
, but it's also easier to leave it in)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's useful to be notified regardless that some modules don't match the drv version number (for whatever reason)
If not, there's a much simpler change: moving the [[ -z "$versionCheck" ]]
condition
I find it odd to talk about “warning fatigue” in that context, since it's usually meant for warnings emitted in nix evaluation. Regardless, I feel the issue is somewhat overstated, since the message is only ever visible when explicitely looking at the build log of In any case, we could easily just not emit the warning at all unless |
LGTM if you could rebase away the fixup.
It's a concept that's applicable to all warnings. Eval warnings can be more visible, so it's worse there. Still bad in build logs though.
Let's just fix it first. We can get into friendly nudging later. |
Thanks! |
Thanks for the merge, @roberth, and sorry for the lack of reply: I was out of the country for the RIPE88 meeting |
Description of changes
Alternative to #310535
Things done
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usageAdd a 👍 reaction to pull requests you find important.